﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
    <title>百度编辑器</title>
    <link rel="stylesheet" type="text/css" href="./themes/default/ueditor.css"/>
    <script type="text/javascript" src="./editor_config.js"></script>
    <script type="text/javascript" src="./editor_all_min.js"></script>
</head>
<body>
    <script type="text/plain" id="myEditor" style="width:100%;">
    </script>
    <script type="text/javascript">
        //获取ID传值
        var _e_url = location.search;
        var text_id;
        var Request = new Object();
        if (_e_url.indexOf("?") != -1) {
            var str = _e_url.substr(1)
            strs = str.split("&");
            for (var i = 0; i < strs.length; i++) {
                Request[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
            }
        }
        if (Request["id"] != null) {
            if (Request["id"].toString() != "") {
                text_id = Request["id"].toString();
            }
        }
        var sLinkFieldName;
        if (text_id != null && text_id.toString() != "") {
            sLinkFieldName = text_id;
        }
        else {
            alert("请传入调用参数ID，即隐藏的内容表单项ID！");
        }
        var oLinkField = parent.document.getElementsByName(sLinkFieldName)[0];
        var oForm = oLinkField.form;
        window.onload = function () {
            try {
                setLinkedField();
            } catch (e) {
                //window.location.reload();
            }
        }
        // 设置所属表单的提交
        function setLinkedField() {
            if (!oLinkField) return;
            var oForm = oLinkField.form;
            if (!oForm) return;
            _attachEvent(oForm, 'submit', AttachSubmit);
        }
        // 提交表单
        function AttachSubmit() {
            oLinkField.value = editor_a.getContent();
        }


        //百度编辑器
        var option = {
            initialContent: oLinkField.value,
            minFrameHeight: 380
        };
        var editor_a = new baidu.editor.ui.Editor(option);
        editor_a.render('myEditor');


    </script>
</body>
</html>
